#include "functors/PoissonSineFunctor.hpp"
#include <math.h>

#include <iostream>

PoissonSineFunctor::PoissonSineFunctor() {
}

PoissonSineFunctor::~PoissonSineFunctor() {
}

PoissonSineFunctor::PoissonSineFunctor(const PoissonSineFunctor &func) {
	om=func.om;
	amp=func.amp;
	ph=func.ph;
}

PoissonSineFunctor::PoissonSineFunctor(double _om) {
	om=_om;
	amp=1.;
	ph=0.;
}

PoissonSineFunctor::PoissonSineFunctor(double _om, double _amp, double _ph) {
	om=_om;
	amp=_amp;
	ph=_ph;
}

double PoissonSineFunctor::operator() (double x) {
	double val=amp*sin(om*x-ph);
	return val > 0. ? val : 0.;
}

double PoissonSineFunctor::integrate(double a, double b) {
	return -amp/om*(cos(om*b-ph)-cos(om*a-ph));
}